package Lib3d.Scenes;


import Lib3d.Vector3d;
import Lib3d.Animation.AnimationFactory;
import Lib3d.MyUtils.ModelFactory;
import Lib3d.SceneGraph.Group;
import Lib3d.SceneGraph.Node;
import Lib3d.SceneGraph.Impl.AnimatedGroupImpl;
import Lib3d.SceneGraph.Impl.GroupImpl;
import Lib3d.SceneGraph.Impl.TranslationImpl;

import java.util.Iterator;

import javax.media.opengl.GLAutoDrawable;

/**
 * A implementation of a scene representing a forest.
 * 
 * @author Wassim Chegham
 * @version 0.1
 * @category Lib3d.Scenes
 * 
 */
public class SceneForest implements Scene {

    final Group tmpRoot = new GroupImpl();

    public SceneForest() {}

    public void addChild(final Node child) {
        this.tmpRoot.addChild(child);
    }

    public Iterator<Node> childIterator() {
        return this.tmpRoot.childIterator();
    }

    public Node draw() {

        this.tmpRoot.addChild(ModelFactory.createTree());

        final Group firTreeGroupe = new TranslationImpl(new Vector3d(300f, 0, 0));
        firTreeGroupe.addChild(ModelFactory.createFirTree());
        this.tmpRoot.addChild(firTreeGroupe);
        // this.tmpRoot.addChild(ModelFactory.createFirTree());

        final AnimatedGroupImpl animation = new AnimatedGroupImpl();
        animation.addAnimation(AnimationFactory.createSimpleAnimation());
        animation.addChild(firTreeGroupe);
        this.tmpRoot.addChild(animation);
        return this.tmpRoot;
    }

    public void draw(final GLAutoDrawable gLDrawable) {
        this.tmpRoot.draw(gLDrawable);
    }

}
